package com.mm.learn.enume;

import com.mm.learn.designpatterns.strategy.Center;
import com.mm.learn.designpatterns.strategy.First;
import com.mm.learn.designpatterns.strategy.Fstrategy;
import lombok.Getter;

/**
 * @author wdx
 * @date 2021年09月23日 9:19
 */
@Getter
public enum FstrategyEnume {

    CENTER(1, new Center(), "第二个字符"),
    FIRST(2, new First(), "第一个字符");

    public static FstrategyEnume valueOf(int id) {
        for (FstrategyEnume fstrategyEnume : FstrategyEnume.values()) {
            if (fstrategyEnume.getId() == id) {
                return fstrategyEnume;
            }
        }
        return FstrategyEnume.CENTER;
    }

    FstrategyEnume(int id, Fstrategy serviceName, String desc) {
        this.id = id;
        this.serviceName = serviceName;
        this.desc = desc;
    }

    private int id;
    private Fstrategy serviceName;
    private String desc;
}
